#ifndef CURUSERMODEL_H
#define CURUSERMODEL_H

#include <QObject>
#include"public/public.h"



class CurUserModel : public QObject
{
    Q_OBJECT

public:

    static CurUserModel * getInstance();
    bool login(const QString &username, const QString &password,QString & strErr);
    void logout();
    QString getUserName() const;
    void setUserName(const QString &username);

    UserType getRole() const;
    void setRole(const UserType &nRole);

    bool updatePwd(QString strOldPwd, QString strNewPwd, QString & strErr);

signals:
    void usernameChanged();
    void roleChanged();
    void loginSuccess();
    void logoutSuccess();

private:
    explicit CurUserModel(QObject *parent = nullptr);
    QString m_username;
    UserType m_nRole;

    static CurUserModel * m_pInstance;
};

#endif // CURUSERMODEL_H
